Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reduce amount of /transaction calls in MetadataTracker in system without change if /nextTransaction is available #434

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

AFaust
Copy link

@AFaust AFaust commented Nov 27, 2024

This PR reduces the overhead in polling for new transactions to index when a system is mostly read-only / without changes for a long time. This is something I had already noticed myself in production systems, but came about as a result of a question in the Alfresco forum. In essence, the longer a system is without a change, the more calls the MetadataTracker executes against the /transactions (and /nextTransaction if available) endpoint of the Repository as it looks for any transaction to index.

This PR adds missing logic to stop the loop to incrementally scan the transaction table when the nextTransaction endpoint is available and returns a value indicating that no newer transaction exists at all. It also adjusts the startTime for the next iteration if a next transaction commit time is available but the transactions return in the subsequent call to the transactions endpoint where somehow already "found" before.

A similar issue exists with the ACL tracker. This also executes an increasing amount of calls to look for newer change sets in any system where no ACL changes are performed for a long time. Since there is no endpoint to find the next commit time for an ACL change set based on the last commit time, the overhead there cannot currently be improved in the same way as in the MetadataTracker.

- immediately stop if no newer transaction found (fewer pointless calls in systems without changes)
- advance startTime when using getNextTxCommitTime to potentially avoid repeated calls if alreadyFoundTransactions (unlikely, but feels wrong not to adjust after having queried that window of time)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants